<%--
  User: aleksey
  Date: Sep 28, 2009
  Time: 2:26:01 PM
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
<html>
<link rel="icon" href="favicon.ico" type="image/x-icon">
<f:view locale="#{localeManager.locale}">
    <f:loadBundle var="msgs" basename="messages"/>
    <head>
        <title><h:outputText value="#{msgs['title']}"/></title>
        <link href="olga.css" rel="stylesheet" type="text/css">
    </head>
    <body>
        <h:form id="list_of_tests">
            <%@include file="logoPanel.jspf"%>
            <%@include file="navigationPanel.jspf"%>

            Problem: <h:outputText value="#{testcase.problem.name}"/>
            <h:dataTable id="problemstable" value="#{testcase.tests}" var="item" styleClass="simpleTable">
                <h:column headerClass="columnHeader">
                    <f:facet name="header"><h:outputText value="ID"/></f:facet>
                    <h:outputText value="#{item.id}"/>
                </h:column>
                <h:column headerClass="columnHeader">
                    <f:facet name="header"><h:outputText value="Index"/></f:facet>
                    <h:outputText value="#{item.index}"/>
                </h:column>
                <h:column headerClass="columnHeader">
                    <f:facet name="header"><h:outputText value=""/></f:facet>
                    <h:commandLink action="#{testcase.viewTest}" value="view">
                        <f:param name="testcase" value="#{item.id}"/>
                    </h:commandLink>
                </h:column>
                <h:column headerClass="columnHeader">
                    <f:facet name="header"><h:outputText value=""/></f:facet>
                    <h:commandLink action="#{testcase.editTest}" value="edit">
                        <f:param name="testcase" value="#{item.id}"/>
                    </h:commandLink>
                </h:column>
                <h:column headerClass="columnHeader">
                    <f:facet name="header"><h:outputText value=""/></f:facet>
                    <h:commandLink action="#{testcase.deleteTest}" value="delete">
                        <f:param name="testcase" value="#{item.id}"/>
                    </h:commandLink>
                </h:column>
            </h:dataTable>
            <h:commandLink action="#{testcase.createTest}" value="Add new test"/><br/><br/>
            <h:commandLink action="#{testcase.deleteAllTests}" value="Delete all tests"/><br/><br/>
        </h:form>
        <h:form id="upload_7z" enctype="multipart/form-data">
            <h:outputText value="Upload from 7z file: "/>
            <t:inputFileUpload id="file" value="#{testcase.uploadedFile}" required="true"/>
            <h:message for="file" style="color: red;" />
            <h:commandButton value="Submit" action="#{testcase.upload}" />
            <h:message for="upload_7z" infoStyle="color: green;" errorStyle="color: red;"/>
        </h:form>
    </body>
</f:view>
</html>
